package com.gec.hawaste.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.hawaste.entity.Qualification;
import com.gec.hawaste.mapper.QualificationMapper;
import com.gec.hawaste.service.IQualificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gec.hawaste.vo.ExamineDo;
import com.gec.hawaste.vo.QualificationDo;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenxys
 * @since 2022-07-01
 */
@Service
public class QualificationServiceImpl extends ServiceImpl<QualificationMapper, Qualification> implements IQualificationService {
    @Override
    public IPage<QualificationDo> selectByCondition(IPage<QualificationDo> page, Map<String, Object> params) {
        QueryWrapper<QualificationDo> queryWrapper = new QueryWrapper<>();
        queryWrapper.gt(params.containsKey("startDate")&&!ObjectUtils.isEmpty(params.get("startDate")),"qualification.create_date",params.get("startDate"))
                .lt(params.containsKey("endDate")&&!ObjectUtils.isEmpty(params.get("endDate")),"qualification.create_date",params.get("endDate"))
                .eq(params.containsKey("type")&&!ObjectUtils.isEmpty(params.get("type")),"qualification.type ",params.get("type"))
                .eq(params.containsKey("check")&&!ObjectUtils.isEmpty(params.get("check")),"qualification.check_code",params.get("check"));

        return baseMapper.selectByCondition(page,queryWrapper);
    }
}
